<% if not request.xhr? %>
<table class="ajax-scaffold" cellpadding="0" cellspacing="0">
  <tbody>
<% end %>
<tr id="<%= element_row_id(@options) %>" <%= "style=\"display:none;\"" if request.xhr? %>>
  <td id="<%= element_cell_id(@options) %>" class="<%= @options[:action] %>" colspan="<%= num_columns %>">
  
    <%= form_remote_tag :url => @options.merge(:controller => '/tasks'), 
    			:loading => "Element.show('#{loading_indicator_id(@options)}'); Form.disable('#{element_form_id(@options)}');",
    			:html => { :href => url_for(@options.merge(:controller => '/tasks')),
                     :id => element_form_id(@options) } %>
      
      <%= hidden_field_tag "scaffold_id", @options[:scaffold_id] %>
         
      <h4><%= Inflector.titleize(@options[:action]) %> Task "<%= @task.name %>"</h4>

      <% if request.xhr? %>
        <div id="<%= element_messages_id(@options) %>" class="messages-container"></div>
      <% else %>
        <%= render :partial => 'form_messages' %>
      <% end %>
            
      <%= render :partial => 'form' %>
      
      <p class="form-footer">
      	<%= submit_tag Inflector.titleize(@options[:action]), :class => "submit" %>
      	<% cancel_params = @options.merge(:controller => '/tasks', :action => 'cancel', :referring_action => @options[:action]) %>
      	<%= link_to_remote "Cancel",
      	  { :url => cancel_params,
      	    :loading => "Element.show('#{loading_indicator_id(@options)}');" },
	        { :href => url_for(cancel_params) } %>    	                          
      	<%= loading_indicator_tag @options %>
    	</p>
    <%= end_form_tag %>
  </td>
</tr>
<% if not request.xhr? %>
  </tbody>
</table>
<% end %>